﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using WpfHostBuilder.Accessors;

namespace WpfHostBuilder
{
    public partial class App : Application
    {
        IHost? host;

        protected override void OnStartup(StartupEventArgs e)
        {
            host = Host.CreateDefaultBuilder(e.Args)
                 .ConfigureServices(services =>
                 {
                     services.AddSingleton<IDataAccessor, DataAccessor>();
                 })
                .UseWPF<AppBootStrapper>()
                //.UseCPF<AppBootStrapper>()
                .Build();

            host.Start();
        }

        protected override void OnExit(ExitEventArgs e)
        {
            host?.Stop();
        }
    }
}
